package com.igeekhome.wzgl.controller;

import com.igeekhome.wzgl.entity.MaterialManagementEntity;
import com.igeekhome.wzgl.service.IMaterialManagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/mm")
@CrossOrigin
public class MaterialManagementController {
    @Autowired
    private IMaterialManagement iMaterialManagement;
    @PostMapping("/insert")
    public int insert(@RequestBody MaterialManagementEntity mm){return iMaterialManagement.insert(mm);}//新增
    @GetMapping ("/inquire")
    public List<MaterialManagementEntity> inquire(@RequestParam String material_brand){
        return iMaterialManagement.inquire(material_brand);}

    @PostMapping("/revise")
    public  int revise(@RequestBody MaterialManagementEntity mm){return iMaterialManagement.revise(mm);}

    @DeleteMapping ("/delete")
    public int delete(@RequestParam int id){return iMaterialManagement.delete(id);}
    @GetMapping("/page")
    public List<MaterialManagementEntity> page(){
        return iMaterialManagement.page();
    }
    @GetMapping("/select")
    public int select(@RequestParam int id){
        return iMaterialManagement.select(id);
    }
    @GetMapping("/getById")
    public MaterialManagementEntity getById(@RequestParam int id){return iMaterialManagement.getById(id);}
    @PostMapping("/updata")
    public  int updata(@RequestBody MaterialManagementEntity mm){return iMaterialManagement.revise(mm);}
}
